package com.hotelsystem.reservation.controllers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.hotelsystem.reservations.layouts.CreateReservationView;
import com.hotelsystem.reservations.rooms.Room;

public class SaveReservationController implements ActionListener {

	private CreateReservationView view;
	private Date startDate;
	private Date endDate;
	private Room room;
	
	

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public Room getRoom() {
		return room;
	}

	public void setRoom(Room room) {
		this.room = room;
	}

	public CreateReservationView getView() {
		return view;
	}

	public void setView(CreateReservationView view) {
		this.view = view;
	}

	public SaveReservationController(CreateReservationView view) {

		this.view = view;

	}

	@Override
	public void actionPerformed(ActionEvent e) {
		SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
		try {
			startDate = df.parse(view.getTxtStartDate().getText());
			endDate = df.parse(view.getTxtEndDate().getText());
		} catch (ParseException e1) {
			e1.printStackTrace();
		}

		System.out.println(startDate);
		System.out.println(endDate);
		System.out.println(view.getRoom());
	}

	
	
}
